// *Author：jxx
// *Contact：283591387@qq.com
// *代码由框架生成,任何更改都可能导致被代码生成器覆盖
export default function(){
    const table = {
        key: 'Id',
        footer: "Foots",
        cnName: '点检保养项目',
        name: 'MaintenanceChecklist',
        url: "/MaintenanceChecklist/",
        sortName: "Id"
    };
    const tableName = table.name;
    const tableCNName = table.cnName;
    const newTabEdit = false;
    const key = table.key;
    const editFormFields = {"ProjectName":"","ProjectCode":"","ProjectType":"","ProjectContent":"","Standard":"","Status":"","Remark":"","autoCreate":0};
    const editFormOptions = [
        [
            {
                "title":"项目编码",
                "field":"ProjectCode",
                "type":"text",
                "required": true,
                "colSize": 8,
                "width": 500,
                "maxlength": 20
            },
            {
                "title":"",
                "field":"autoCreate",
                "type":"switch",
                "value": 0,
                "colSize": 4,
                "onChange": (val, option) => {
                    if (val) {
                        option.data.ProjectCode = 'SUB' + Math.floor(Math.random() * 900 + 100);
                    }
                },
                "extra": {
                    "style": "margin-left: 5px;display: inline-flex;align-items: center;"
                }
            }
        ],
        [
            {"title":"项目名称","field":"ProjectName","type":"text","required": true,"colSize": 12,"maxlength": 100}
        ],
        [
            {"dataKey":"项目类型","data":[],"title":"项目类型","field":"ProjectType","type":"radio","required": true,"colSize": 12}
        ],
        [
            {"title":"项目内容","field":"ProjectContent","type":"textarea","required": true,"colSize": 12,"maxlength": 500}
        ],
        [
            {"title":"标准","field":"Standard","type":"text","required": true,"colSize": 6,"maxlength": 200,
                "validator": [{
                    required: true,
                    message: "请输入标准",
                    trigger: 'blur'
                }, {
                    validator: (rule, value, callback) => {
                        if (value && /^\s+$/.test(value)) {
                            callback("标准不能全为空格");
                            return;
                        }
                        callback();
                    },
                    trigger: 'blur'
                }]
            },
            {"dataKey":"状态01","data":[],"title":"状态","field":"Status","type":"radio","required": true,"colSize": 6,
                "validator": [{
                    required: true,
                    message: "请选择状态",
                    trigger: 'change'
                }]
            }
        ],
        [
            {
                "title": "备注",
                "field": "Remark",
                "type": "textarea",
                "colSize": 12,
                "maxlength": 500,
                "placeholder": "请输入备注信息",
                "required": true,
                "validator": [{
                    required: true,
                    message: "请输入备注信息",
                    trigger: 'blur'
                }, {
                    message: "备注内容至少输入2个字符",
                    min: 2,
                    trigger: 'blur'
                }, {
                    validator: (rule, value, callback) => {
                        if (value && /^\s+$/.test(value)) {
                            callback("备注内容不能全为空格");
                            return;
                        }
                        callback();
                    },
                    trigger: 'blur'
                }]
            }
        ]
    ];
    const searchFormFields = {"ProjectName":"","ProjectCode":"","ProjectType":""};
    const searchFormOptions = [[{"title":"项目编码","field":"ProjectCode","type":"="},{"title":"项目名称","field":"ProjectName","type":"like"},{"dataKey":"项目类型","data":[],"title":"项目类型","field":"ProjectType","type":"select"}]];
    const columns = [{field:'Id',title:'主键',type:'int',width:110,require:true,align:'left'},
                       {field:'ProjectName',title:'项目名称',type:'string',width:110,align:'left'},
                       {field:'ProjectCode',title:'项目编码',type:'string',width:110,align:'left'},
                       {field:'ProjectType',title:'项目类型',type:'string',bind:{ key:'项目类型',data:[]},width:110,align:'left'},
                       {field:'ProjectContent',title:'项目内容',type:'string',width:110,align:'left'},
                       {field:'Standard',title:'标准',type:'string',width:110,align:'left'},
                       {field:'Status',title:'状态',type:'int',bind:{ key:'状态01',data:[]},width:110,align:'left'},
                       {field:'Remark',title:'备注',type:'string',width:110,align:'left'}];
    const detail ={columns:[]};
    const details = [];

    return {
        table,
        key,
        tableName,
        tableCNName,
        newTabEdit,
        editFormFields,
        editFormOptions,
        searchFormFields,
        searchFormOptions,
        columns,
        detail,
        details
    };
}